package com.sample.rx.libs.rxjava;

import android.content.Context;
import android.graphics.Bitmap;

import com.loyal.rx.BaseRxSubscriber;
import com.loyal.rx.RetroManager;

import io.reactivex.Observable;

public class RxJavaTaskSubscriber<T> extends BaseRxSubscriber<T> implements RxJavaTaskServer {

    @Override
    public void createServer(RetroManager callManager) {

    }

    public RxJavaTaskSubscriber(Context context) {
        super(context);
        showProgressDialog(true);
    }

    @Override
    public Observable<String> saveBmp(final String savePath, final Bitmap bitmap) {
        return Observable.just(savePath).
                map(path -> {
                    Thread.sleep(2000L);
                    return "RxJava测试";
                });
    }

    @Override
    public Observable<String> saveByteArray(String savePath, final byte[] bytes) {
        return Observable.just(savePath).map(path -> /*ImageUtil.savePhoto(bytes, path)*/"");
    }
}

